package com.qifan.energy.fragment;

import android.view.View;

import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.qifan.energy.R;
import com.qifan.energy.adapter.CartListAdapter;
import com.qifan.energy.adapter.CollegeListAdapter;
import com.qifan.energy.base.BaseFragment;
import com.qifan.energy.bean.result.CartListResult;
import com.qifan.energy.http.net.NetUtils;
import com.qifan.energy.http.response.MyObserver;
import com.qifan.energy.util.ToastUtils;
import com.yqritc.recyclerviewflexibledivider.HorizontalDividerItemDecoration;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;

public class StudyFragment extends BaseFragment {

    @BindView(R.id.recycler_view)
    RecyclerView recyclerView;

    private List<String> dataList = new ArrayList(){{
        add("hahahha1");
        add("hahahha2");
        add("hahahha3");
        add("hahahha4");
        add("hahahha5");
        add("hahahha6");
    }};

    public static StudyFragment newInstance() {
        return new StudyFragment();
    }

    @Override
    public int getLayoutId() {
        return R.layout.fragment_study;
    }

    @Override
    protected void initView(View view) {

        /* 适配器设置 */
        CollegeListAdapter adapter = new CollegeListAdapter(dataList);
        adapter.setOnItemClickListener((a,v,p) -> {
            ToastUtils.showShort("详情页面开发中");
        });
        recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
        recyclerView.setAdapter(adapter);
        recyclerView.addItemDecoration(new HorizontalDividerItemDecoration.Builder(getActivity())
                .sizeResId(R.dimen.dp_0_5)
                .colorResId(R.color.divider_color)
                .build());
    }

    /* 获取空布局 */
    /*private View getEmptyDataView() {
        return getLayoutInflater().inflate(R.layout.cart_list_empty, recyclerView, false);
    }*/

    @Override
    public void initData() {

    }
}
